﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Pocahontas.Mocks;

namespace Pocahontas.Tests
{
	[TestFixture]
	public class SitecoreItemFieldExtensionsTests
	{
		[Test]
		public void TestTryGetValueGenericString()
		{
			// Arrange
			MockSitecoreItemField field = new MockSitecoreItemField("", "hello");

			string value;

			// Act
			bool result = field.TryConvertValue(out value);

			// Assert
			Assert.IsTrue(result);
			Assert.AreEqual("hello", value);
		}

		[Test]
		public void TestTryGetValueString()
		{
			// Arrange
			MockSitecoreItemField field = new MockSitecoreItemField("", "hello");

			object value;

			// Act
			bool result =  field.TryConvertValue(typeof(string), out value);

			// Assert
			Assert.IsTrue(result);
			Assert.AreEqual("hello", value);
		}
	}
}
